home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_01 / xmpl_02.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  835 b   |  42 lines  |  [TEXT/ttxt]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 1, example 2
  5.  
  6. --create a module to avoid name conflicts
  7. module Scratch0 uses ScriptX end
  8. in module Scratch0
  9.  
  10. class Dog ()
  11.     instance variables 
  12.         name, owner, breed, age, length, weight, sex, temperament
  13.     instance methods
  14.         method bark self -> print "makes a lot of noise" 
  15.         method fetch self -> print "fetches a stick" 
  16.         method sniff self -> print "sticks nose into things"
  17. end
  18.  
  19. class HuntingHound (Dog)
  20.     instance methods
  21.         method bark self -> print "wooof, wooof"
  22. end
  23.  
  24. class LapDog (Dog)
  25.     instance methods
  26.         method bark self -> print "yip, yip, yip, yip, yip"
  27. end
  28.  
  29. class Shihtzu (LapDog)
  30.     instance methods
  31.         method bark self -> (
  32.             nextMethod self
  33.             print "jumps up and down"
  34.         )
  35. end
  36.  
  37. object tyler (Shihtzu)
  38.     settings name:"Tyler"
  39. end
  40.  
  41. bark tyler
  42. -->>>